package com.googlecode.likesql.dml;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;

import com.googlecode.likesql.LikeSql;
import com.googlecode.likesql.context.InsertSqlContext;


/**
 * @author Johny Huang
 * 
 */
public class Value implements LikeSql {

	private InsertSqlContext context;

	public Value(InsertSqlContext context) {
		this.context=context;
	}

	public Value value(String columnName, long value) {
		context.addColumnValue(columnName,new Long(value));
		return this;
	}

	public Value value(String columnName, double value) {
		context.addColumnValue(columnName,new Double(value));
		return this;
	}

	public Value value(String columnName, Object value) {
		context.addColumnValue(columnName,value);
		return this;
	}

	public String toString() {
		return context.getSql();
	}

	public String toTemplate() {
		return context.getTemplate();
	}

	public PreparedStatement toPreStatement(Connection con) throws SQLException {
		return context.getPreStatement(con);
	}

	public List getValueList() {
		return context.getValueList();
	}
}
